#include "videowidget.h"


VideoWidget::VideoWidget(QWidget *parent) : QWidget(parent)
{
    setupPlayer();

    setupUI();
}

void VideoWidget::setupUI()
{

}

void VideoWidget::setupPlayer()
{
    WId wid = winId();
    m_player.reset(av::LitePlayerFactory::create((void*)wid), av::LitePlayerFactory::destroy);
	m_player->setImage("hello.bmp");
	
	m_player->setProp(MEDIA_VIDEO_PROP_DRAW_RECT, "true");
}

bool VideoWidget::open(const QString& url)
{
    std::string str = url.toStdString();
    m_player->open(str.c_str());
    m_player->play();

    return true;
}

void VideoWidget::close()
{
    m_player->stop();
    m_player->close();
}
